<?php
class a{
    private static $data = [];
    public function __set($name,$value){
        self::$data[$name] = $value;
    }
    public function __get($name){
        return self::$data[$name];
    }
}
$a = new a();
$a->b = 123;
echo $a->b;